package annotation;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Created by butterfly on 2018/6/25.
 */
public class TestProcessor {

    public static void process(String clazz){
        try {
            Method[] methods = new MyTest().getClass().getMethods();
            for (Method method : methods) {
                if (method.isAnnotationPresent(Testable.class)){
                    method.invoke(null);
                }
            }
        }  catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        process("MyTest");
    }

}
